flowbox: Fix get_child_at_index crash with an invalid index
authorDebarshi Ray <debarshir@gnome.org>
Fri, 2 Dec 2016 15:38:05 +0000 (16:38 +0100)
committerDebarshi Ray <debarshir@gnome.org>
Fri, 2 Dec 2016 18:17:40 +0000 (19:17 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=775525

gtk/gtkflowbox.c

index 38a528b6321b935f16a0f47a30bfaeb1f733b37e..66535af4e13ed776b125fc2afaefe4b0d4217bb4 100644 (file)
@@ -4272,7 +4272,7 @@ gtk_flow_box_get_child_at_index (GtkFlowBox *box,
   g_return_val_if_fail (GTK_IS_FLOW_BOX (box), NULL);
 
   iter = g_sequence_get_iter_at_pos (BOX_PRIV (box)->children, idx);
-  if (iter)
+  if (!g_sequence_iter_is_end (iter))
     return g_sequence_get (iter);
 
   return NULL;